package com.java.jiuyang.cloud.cleancode.errorhandle;

import org.springframework.http.HttpStatus;

/**
 * @ClassName: ExceptionEnum
 * @Description:
 * @Version: v1.0.0
 * @Author: Fu Hao
 * @Date: 2019/11/12 0012 上午 9:20
 * Modification History:
 * Date           Author      Version     Description
 * -------------------------------------------------------------
 * 2019/11/12 0012        Fu Hao      v1.0.0         创建
 */
/*异常枚举类和自定义异常类配合使用，参数也是三个：请求响应状态码，异常码和异常信息*/
public enum ExceptionEnum {


    LOGIN_USERNAME_ERROR(10001, "login fail", HttpStatus.BAD_REQUEST),
    LOGIN_PASSWORD_ERROR(10002, "login fail", HttpStatus.BAD_REQUEST);

    private int error_code;
    private String error_desc;
    private HttpStatus httpStatus;

    ExceptionEnum(int code, String msg, HttpStatus status) {
        this.error_code = code;
        this.error_desc = msg;
        this.httpStatus = status;
    }

    public int getError_code() {
        return error_code;
    }
    public void setError_code(int error_code) {
        this.error_code = error_code;
    }
    public String getError_desc() {
        return error_desc;
    }
    public void setError_desc(String error_desc) {
        this.error_desc = error_desc;
    }
    public HttpStatus getHttpStatus() {
        return httpStatus;
    }
    public void setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
    }
}
